// ui/components/WhiteboardInput.js
// Assuming ElementPlus components (ElInput, ElButton) and icons (Plus) are globally available.

export default {
  name: 'WhiteboardInput',
  // props: {}, // No props defined in the .vue file
  emits: ['add-path'],
  setup(props, { emit }) {
    const { ref } = Vue; // Vue is global

    const filePath = ref('');

    function handleAddPath() {
      if (filePath.value && filePath.value.trim() !== '') {
        emit('add-path', filePath.value.trim());
        filePath.value = ''; // Clear input after emitting
      }
    }

    return {
      filePath,
      handleAddPath,
      // props are automatically available if defined
    };
  },
  template: `
  <div class="whiteboard-input-container">
    <el-input
      v-model="filePath"
      placeholder="输入本地文件的完整绝对路径"
      @keyup.enter="handleAddPath"
      class="file-path-input-el"
      clearable
    />
    <el-button
      type="primary"
      icon="Plus"
      @click="handleAddPath"
      :disabled="!filePath.trim()"
      class="add-button-el"
    >
      添加到白板
    </el-button>
  </div>
  `
};